package b.b.c;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import androidx.appcompat.app.AppCompatDelegateImpl;
import b.f.c;
import b.i.k.e;

/* compiled from: AppCompatDialog */
public class m extends Dialog implements g {
    public h a;
    public final b.i.k.e.a b;

    /* compiled from: AppCompatDialog */
    public class a implements b.i.k.e.a {
        public boolean e(KeyEvent keyEvent) {
            return m.this.b(keyEvent);
        }
    }

    public m(Context context, int i) {
        int i2;
        if (i == 0) {
            TypedValue typedValue = new TypedValue();
            context.getTheme().resolveAttribute(2130968858, typedValue, true);
            i2 = typedValue.resourceId;
        } else {
            i2 = i;
        }
        super(context, i2);
        this.b = new a();
        h a = a();
        if (i == 0) {
            TypedValue typedValue2 = new TypedValue();
            context.getTheme().resolveAttribute(2130968858, typedValue2, true);
            i = typedValue2.resourceId;
        }
        a.y(i);
        a.l(null);
    }

    public h a() {
        if (this.a == null) {
            c cVar = h.a;
            this.a = new AppCompatDelegateImpl(getContext(), getWindow(), this, this);
        }
        return this.a;
    }

    public void addContentView(View view, LayoutParams layoutParams) {
        a().c(view, layoutParams);
    }

    public boolean b(KeyEvent keyEvent) {
        return super.dispatchKeyEvent(keyEvent);
    }

    public void dismiss() {
        super.dismiss();
        a().m();
    }

    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        return e.b(this.b, getWindow().getDecorView(), this, keyEvent);
    }

    public <T extends View> T findViewById(int i) {
        return a().e(i);
    }

    public void g(b.b.g.a aVar) {
    }

    public void h(b.b.g.a aVar) {
    }

    public void invalidateOptionsMenu() {
        a().j();
    }

    public b.b.g.a k(b.b.g.a.a aVar) {
        return null;
    }

    public void onCreate(Bundle bundle) {
        a().i();
        super.onCreate(bundle);
        a().l(bundle);
    }

    public void onStop() {
        super.onStop();
        a().r();
    }

    public void setContentView(int i) {
        a().u(i);
    }

    public void setTitle(CharSequence charSequence) {
        super.setTitle(charSequence);
        a().z(charSequence);
    }

    public void setContentView(View view) {
        a().v(view);
    }

    public void setContentView(View view, LayoutParams layoutParams) {
        a().w(view, layoutParams);
    }

    public void setTitle(int i) {
        super.setTitle(i);
        a().z(getContext().getString(i));
    }
}
